<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('讨论区')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="role-form">
                <div class="select-list">
                    <ul>
                        <li>
                            工号：<input name="userId" type="text"/>
                        </li>
                        <li>
                            作者：<input name="author" type="text"/>
                        </li>
                        <li>
                            主题：<input name="talkCenter" type="text"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">

        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var seeFlag = [[${@permission.hasPermi('system:talk:see')}]];
    var prefix = ctx + "sau/talk";


    $(function () {
        var options = {
            url: prefix + "/selectTalk",
            updateUrl: prefix + "/see/{id}",
            sortName: "talkId",
            modalName: "帖子",
            columns: [
                {
                    field: 'talkId',
                    title: '编号',
                },
                {
                    field: 'talkCenter',
                    title: '主题'
                },
                {
                    field: 'userId',
                    title: '工号'
                },
                {
                    field: 'author',
                    title: '作者'
                },
                {
                    field: 'talkTime',
                    title: '发帖时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + seeFlag + '" href="javascript:void(0)" onclick="see(\'' + row.talkId + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function see(id) {
        table.set();
        if ($.common.isEmpty(id) && table.options.type == table_type.bootstrapTreeTable) {
            var row = $("#" + table.options.id).bootstrapTreeTable('getSelections')[0];
            if ($.common.isEmpty(row)) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            var url = table.options.updateUrl.replace("{id}", row[table.options.uniqueId]);
            $.modal.open(table.options.modalName + "详情", url);
        } else {
            $.modal.open(table.options.modalName + "详情", $.operate.editUrl(id));
        }
    }

</script>
</body>
</html>